<template>
  <div>
    <el-container class="body">
      <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
        <el-menu router :default-openeds="['']" unique-opened default-active="$route.path"> 
          <el-submenu index="1">
            <template slot="title" route="/">
              <i class="el-icon-message"></i>个人中心
            </template>
          </el-submenu>
          <el-submenu index="/user">
            <template slot="title">
              <i class="el-icon-menu"></i>用户管理
            </template>
            <el-menu-item-group>
              <template slot="title">分组一</template>
              <el-menu-item index="/user/list">用户数据</el-menu-item>
              <el-menu-item index="/user/info">用户信息</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="/goods">
            <template slot="title">
              <i class="el-icon-setting"></i>商品管理
            </template>
            <el-menu-item-group>
              <template slot="title">分组一</template>
              <el-menu-item index="/goods/list">商品数据</el-menu-item>
              <el-menu-item index="/goods/info">商品信息</el-menu-item>
            </el-menu-item-group>
            <el-menu-item-group title="分组2">
              <el-menu-item index="3-3">选项3</el-menu-item>
            </el-menu-item-group>
            <el-submenu index="3-4">
              <template slot="title">选项4</template>
              <el-menu-item index="3-4-1">选项4-1</el-menu-item>
            </el-submenu>
          </el-submenu>
        </el-menu>
      </el-aside>
      <el-container>
        <el-header style="text-align: right; font-size: 12px">
          <el-dropdown>
            <i class="el-icon-setting" style="margin-right: 15px"></i>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item>查看</el-dropdown-item>
              <el-dropdown-item>新增</el-dropdown-item>
              <el-dropdown-item>删除</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
          <span>王小虎</span>
        </el-header>
        <el-main>
          <bread :brlist='br'></bread>
          <router-view :key="$route.path"></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>
<style>
.body {
  height: 100vh;
  min-width: 1000px;
}
.el-header {
  background-color: #b3c0d1;
  color: #333;
  line-height: 60px;
}

.el-aside {
  color: #333;
}
</style>

<script>
import Bread from "@/components/Bread.vue";
export default {
  data() {
    return {
      br:{}
    }
  },
  components:{
    Bread
  },
  watch: {
    $route(){
      this.br=this.$route.meta
    }
  },
  created() {
    this.br=this.$route.meta
  },
};
</script>